package gui.options;

import java.util.TreeSet;

import eclMain.ChatFile;
import eclMain.FileManager;

//holds the various settings for a particular text manager
//TODO: have these settings write to a config file that only attaches to the name of a particular text manager
/**Initializes with default settings*/
public class TextManagerSettings {

	//Chat line settings
	private boolean showTimeStamp = true;
	private boolean showOwner = true; //the owner is the character that said the line
	private boolean showText = true;
	private boolean showChannelName = false;
	private boolean showListener = false; //the listener is the character whose chat log contained this line
	
	private TreeSet<String> followedChannels = new TreeSet<String>(); //since I have to add channel names directly from the followed files, I need to account for duplicates
	
	public void setText(boolean toShow) {this.showText = toShow;}
	public boolean getText() {return this.showText;}
	
	public void setListener(boolean toShow) {this.showListener = toShow;}
	public boolean getListener() {return this.showListener;}
	
	public void setChannelName(boolean toShow) {this.showChannelName = toShow;}
	public boolean getChannelName() {return this.showChannelName;}
	
	public void setTimeStamp(boolean toShow) {this.showTimeStamp = toShow;}
	public boolean getTimeStamp() {return this.showTimeStamp;}
	
	public void setOwner(boolean toShow) {this.showOwner = toShow;}
	public boolean getOwner() {return this.showOwner;}
	
	public void followChannel(String channel) {
		this.followedChannels.add(channel);
	}
	
	/**Get the current list of followed files, and add all of their channel names to the list*/
	public void followAllChannels() {
		for (ChatFile file : FileManager.getMasterList()) {
			this.followedChannels.add(file.getChannel().getChannelName());
		}
	}
	
	public void unfollowAllChannels() {
		this.followedChannels.clear();
	}
	
	public TreeSet<String> getFollowedChannels() {
		return this.followedChannels;
	}
}
